#!/bin/bash
JAVA=/opt/soft/java/bin/java
EFIX=/opt/web/heatmap
cd $EFIX
CP=$EFIX
export LANG="en_US.UTF-8"
for i in $EFIX/lib/*.jar;do
        CP="$i:$CP"
done
var=`date +%Y%m%d`

if [ $# -eq 1 ]; then
    beginDay="$1"
    endDay="$1"
elif [ $# -eq 2 ]; then
    beginDay="$1"
    endDay="$2"
else
    beginDay=`date +%Y%m%d --date '-1 day'`
    endDay=`date +%Y%m%d --date '-1 day'`
fi

while [[ $beginDay -le $endDay ]] ; do
    $JAVA -classpath $CP -Xms3g -Xmx3g com.bj58.heatmap.main.ChangeStyle_PC $beginDay 1>logs/changeStyleLog/stdout_$var.log 2>logs/changeStyleLog/stderr_$var.log &
    $JAVA -classpath $CP -Xms3g -Xmx3g com.bj58.heatmap.main.ChangeStyle_PC_Month $beginDay 1>>logs/changeStyleLog/stdout_$var.log 2>>logs/changeStyleLog/stderr_$var.log &
    $JAVA -classpath $CP -Xms3g -Xmx3g com.bj58.heatmap.main.ChangeStyle_M $beginDay 1>logs/changeStyleLog/stdoutM_$var.log 2>logs/changeStyleLog/stderrM_$var.log &
    wait
    beginDay=$(date -d "$beginDay +1 days" "+%Y%m%d")
done

##/usr/bin/rsync  --daemon --config=/etc/rsyncd.conf
# rsync -aSvH --password-file=/etc/rsyncd.secrets /opt/web/bi.t.58.com/views/heatmap_v2/ zhaoxiang@10.5.20.13::views_v2 1>>logs/rsyncLog/stdout2_$var.log 2>>logs/rsyncLog/stdout2_$err.log
rsync -azvH  /opt/web/bi.t.58.com/views/heatmap/ "10.126.84.136:/opt/web/bi.t.58.com/views/heatmap/" 1>>logs/rsyncLog/stdout.log.$var 2>>logs/rsyncLog/stderr.log.$var
rsync -azvH  /opt/web/bi.t.58.com/resources/heatmap/ "10.126.84.136:/opt/web/bi.t.58.com/resources/heatmap/" 1>>logs/rsyncLog/stdout.log.$var 2>>logs/rsyncLog/stderr.log.$var
